package com.qianxx.component.activity.chart.statistical_bar;

import android.os.Bundle;
import android.widget.Toast;

import com.qianxx.component.R;
import com.qianxx.component.activity.base.BaseActivity;
import com.qianxx.viewlibrary.chart.statistical.HorizontalStatisticalBar;
import com.qianxx.viewlibrary.chart.statistical.HorizotalStatisticalPanel;
import com.qianxx.viewlibrary.chart.statistical.StatisticalBar;
import com.qianxx.viewlibrary.chart.statistical.StatisticalPanel;

import java.util.ArrayList;
import java.util.List;

public class StatisticalBarActivity extends BaseActivity implements HorizotalStatisticalPanel.OnItemClickListener{
    List<Double> list = new ArrayList<>();
    StatisticalBar sbar;
    StatisticalPanel sp;
    HorizotalStatisticalPanel hsp;
    HorizontalStatisticalBar hsb;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_statistical_bar);

        list.add(35668.89);
        list.add(78668.12);
        list.add(58667.12);
        list.add(29762.86);
        list.add(16700.68);
        list.add(0.00);
        list.add(67887.50);

        sbar = findViewById(R.id.sbar);
        sbar.setMaxValue(10000.00);
        sbar.setCurValue(5976.86);
        sbar.setShowIndicator(true);

        sp = findViewById(R.id.sp);
        sp.setMaxValue(100000.00);
        sp.setList(list);

        hsb = findViewById(R.id.hsb);
        hsb.setMaxValue(100000.00);
        hsb.setCurValue(78666.12);

        hsp = findViewById(R.id.hsp);
        hsp.setMaxValue(100000.00);
        hsp.setList(list);
        hsp.setOnItemClickListener(this);
    }

    @Override
    public String setTitle() {
        return "StatisticalBar";
    }

    @Override
    public void onItemClick(int position, double value) {
        Toast.makeText(this,position+"",Toast.LENGTH_SHORT).show();
    }
}
